
package com.joysuch.wwyt.risk.enums;

/**
 * 评估状态.
 *
 */
public enum RiskPointSubTypes {
    DEVICE_SHENG_CHAN("device", "sc", "生产设备设施"),
    DEVICE_XIAO_FANG("device", "xf", "消防设施"),
    DEVICE_AN_QUAN_FANG_HU("device", "aqfh", "安全防护设施"),
    JOB_JIN_JI_CHU_ZHI("job", "jjcz", "紧急处置"),
    JOB_LI_XING_CAO_ZUO("job", "lxcz", "例行操作"),
    JOB_SHE_BEI_JIAN_XIU("job", "sbjx", "设备检修"),
    JOB_XIAN_CHANG_SHI_GONG("job", "xcsg", "现场施工");

    private String parentType;
    private String code;
    private String name;

    private RiskPointSubTypes(String parentType, String code, String name) {
        this.parentType = parentType;
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getParentType() {
        return parentType;
    }

    public boolean is(String code) {
        return code != null && this.code.equals(code);
    }

    public static String findNameByCode(String code) {
        if (code == null) {
            return null;
        }
        RiskPointSubTypes[] values = RiskPointSubTypes.values();
        for (RiskPointSubTypes v : values) {
            if (v.code.equals(code)) {
                return v.name;
            }
        }
        return null;
    }

}
